﻿
@{
    ViewBag.Title = ViewBag.SingleTitle = "题目管理";
    Layout = "~/Views/Shared/_SysManage.cshtml";
}
@section header{
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/all.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-editable.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-table.css" rel="stylesheet" />
    <script src="~/Scripts/bootstrap-editable.min.js"></script>
    <script src="~/Scripts/BTTable/bootstrap-table.js"></script>
    <script src="~/Scripts/BTTable/bootstrap-table-zh-CN.js"></script>
    <script src="~/Scripts/BTTable/bootstrap-table-editable.js"></script>
    <script src="~/Scripts/bootstrap-datepicker.js"></script>
    <script src="~/Scripts/bootstrap-datepicker.zh-CN.js"></script>
    <script src="~/Scripts/BTTable/tableExport.min.js"></script>
    <script src="~/Scripts/BTTable/bootstrap-table-export.js"></script>
}
<section class="bg-white">
    <div id="UtableHide">
        <table id="table"
               data-toggle="table"
               data-toolbar="#Utoolbar"
               data-url="@Url.Action("AdminGetScore", "ScoreCenter")"
               data-method="post"
               data-offset="1"
               data-page-size="10"
               data-pagination="true"
               data-page-number="1"
               data-side-pagination="server"
               data-flat="true"
               data-sort-name="UserName"
               data-sort-order="asc"
               data-search="true"
               data-page-list="[5,10,All]"
               data-show-refresh="true"
               data-show-toggle="true"
               data-show-fullscreen="true"
               data-show-columns="true"
               data-show-export="true"
               data-show-footer="false"
               data-minimum-count-columns="2"
               data-silent="true"
               data-uniqueld="UserName"
               data-height="460"
               data-query-params="queryParams">
            <thead>
                <tr>
                    <th data-field="UtId" data-align="center">统测号</th>
                    <th data-field="RealUserName">姓名</th>
                    <th data-field="UserName" data-sortable="true">学号</th>
                    <th data-field="EndTime" data-formatter="changeDateFormat" data-sortable="true">提交时间</th>
                    <th data-field="Score" data-formatter="scoreFormatter" data-sortable="true" data-align="center">得分</th>
                </tr>
            </thead>
        </table>
    </div>
    <script>
        function queryParams(params) {
            var temp = {
                limit: params.limit,   //页面大小
                offset: params.offset,  //页码
                Id: 3,
                keyword: params.search,//搜索
                sortOrder: params.order,//排序
                sortName: params.sort//排序字段
            };
            return temp;
        };

        //分数
        function scoreFormatter(value) {
            var a = "";
            if (value < 60) {
                var a = '<span style="color:#c12e2a">' + value + '</span>';
            } else if (value >= 60) {
                var a = '<span style="color:#3e8f3e">' + value + '</span>';
            }
            return a;

        }

        //时间
        function changeDateFormat(cellval) {
            if (cellval != null) {
                var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                var milliseconds = date.getMilliseconds() < 100 ? "0" + date.getMilliseconds() : date.getMilliseconds();
                return date.getFullYear() + "-" + month + "-" + currentDate + " " + hours + ":" + minutes + ":" + seconds + "." + milliseconds;
            }
        }
        var $table = $('#table');
        var $button = $('#button');
        $(function () {
            $("#select").on("change", function () {
                $("#UtId").val($('#select option:selected').val());
                $table.bootstrapTable('refresh');
            });
        });
    </script>
</section>
